package basicShapes;

import java.awt.Graphics2D;
import java.awt.geom.Line2D;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;

import image.Image;

@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
    "x1",
    "y1",
    "x2",
    "y2"
})
@XmlRootElement
public class Line extends Image {

	@XmlAttribute
	protected int x1;
	@XmlAttribute
	protected int y1;
	@XmlAttribute
	protected int x2;
	@XmlAttribute
	protected int y2;
	
	public Line() {
		
	}
	
	public Line(int x1, int y1, int x2, int y2) {
		this.x1 = x1;
		this.y1 = y1;
		this.x2 = x2;
		this.y2 = y2;
	}
	
	public void draw( Graphics2D g){
		g.draw(new Line2D.Double(x1, y1, x2, y2));
	}
	public String toString(){
		return "Line - x1:"+this.x1
					+" y1:"+this.y1
					+" x2:"+this.x2
					+" y2:"+this.y2;
	}
}
